package com.zjw.designPattern.listener.observer;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;

import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @description:
 * @author: zhangjiawei
 * @createTime:2022/3/9 17:15
 * @modified by:
 */
@Slf4j
public class FundBarometerEventListener implements ObserverListener{
    @Override
    public Logger getLogger() {
        return log;
    }

    @Override
    public void onFundOfferEvent(FundOfferEvent event, long sequence, boolean endOfBatch) throws IOException {
        log.info("start to handle FundBarometerEventHandler: " + sequence);
        Collection<? extends FundOffer> offers = event.getOffers();
        FundOffer oldOffer = event.getOldOffer();
        List<String> collect = offers.stream().map(o -> o.getOrgName()).collect(Collectors.toList());
        log.info("所有的机构名称:{}",collect);
    }
}
